package com.my.screenadapter.mvp;

import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Toast;

import com.my.screenadapter.R;

/**
 * https://segmentfault.com/a/1190000006104275
 *
 * 腾讯Bugly干货分享】一步一步实现 Android 的 MVP 框架
 */
public class MVPActivity extends AppCompatActivity implements IMainView{
    MainPresenter presenter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_mvp);
    }

    @Override
    public void onShowString(String json) {
        Toast.makeText(MVPActivity.this,json,Toast.LENGTH_LONG).show();
    }

    public void loadData(View view) {
        presenter = new MainPresenter();
        presenter.addTaskListener(this);
        presenter.getStringAndShow();
    }
}
